<html>
<head><meta charset="utf-8"><title>Force warnings on lints  compiler-team#434 · t-compiler/major changes · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/index.html">t-compiler/major changes</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Force.20warnings.20on.20lints.20.20compiler-team.23434.html">Force warnings on lints  compiler-team#434</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="239602644"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Force%20warnings%20on%20lints%20%20compiler-team%23434/near/239602644" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> triagebot <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Force.20warnings.20on.20lints.20.20compiler-team.23434.html#239602644">(May 20 2021 at 14:38)</a>:</h4>
<p>A new proposal has been announced: <a href="https://github.com/rust-lang/compiler-team/issues/434">Force warnings on lints  #434</a>. It will be announced at the next meeting to try and draw attention to it, but usually MCPs are not discussed during triage meetings. If you think this would benefit from discussion amongst the team, consider proposing a design meeting.</p>



<a name="239602725"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Force%20warnings%20on%20lints%20%20compiler-team%23434/near/239602725" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> triagebot <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Force.20warnings.20on.20lints.20.20compiler-team.23434.html#239602725">(May 20 2021 at 14:38)</a>:</h4>
<p><span class="user-group-mention" data-user-group-id="492">@T-compiler</span>: Proposal <a href="https://github.com/rust-lang/compiler-team/issues/434#issuecomment-845180970">#434</a> has been seconded, and will be approved in 10 days if no objections are raised.</p>



<a name="239603803"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Force%20warnings%20on%20lints%20%20compiler-team%23434/near/239603803" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Force.20warnings.20on.20lints.20.20compiler-team.23434.html#239603803">(May 20 2021 at 14:45)</a>:</h4>
<p>Is this sort of lint 'cap-lints', but a 'minimum' level instead of a 'maximum' level?</p>



<a name="239603857"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Force%20warnings%20on%20lints%20%20compiler-team%23434/near/239603857" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Force.20warnings.20on.20lints.20.20compiler-team.23434.html#239603857">(May 20 2021 at 14:45)</a>:</h4>
<p>e.g. we enforce that a lint is always at least <code>warn</code> (but it could still be denied/forbidden)</p>



<a name="239603858"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Force%20warnings%20on%20lints%20%20compiler-team%23434/near/239603858" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Force.20warnings.20on.20lints.20.20compiler-team.23434.html#239603858">(May 20 2021 at 14:45)</a>:</h4>
<p>on particular lints, I think, right?</p>



<a name="239603868"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Force%20warnings%20on%20lints%20%20compiler-team%23434/near/239603868" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Force.20warnings.20on.20lints.20.20compiler-team.23434.html#239603868">(May 20 2021 at 14:45)</a>:</h4>
<p>cap-lints is global.</p>



<a name="239603879"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Force%20warnings%20on%20lints%20%20compiler-team%23434/near/239603879" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Force.20warnings.20on.20lints.20.20compiler-team.23434.html#239603879">(May 20 2021 at 14:45)</a>:</h4>
<p>right</p>



<a name="240634801"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Force%20warnings%20on%20lints%20%20compiler-team%23434/near/240634801" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Force.20warnings.20on.20lints.20.20compiler-team.23434.html#240634801">(May 28 2021 at 17:19)</a>:</h4>
<p>Hm, I don't love that this is specific to warnings.</p>



<a name="240634964"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Force%20warnings%20on%20lints%20%20compiler-team%23434/near/240634964" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Force.20warnings.20on.20lints.20.20compiler-team.23434.html#240634964">(May 28 2021 at 17:20)</a>:</h4>
<p>--cap-lints does have sufficient flexibility that adjusting it to support specific lints is possible still. <code>--force-warn</code> doesn't really leave any room for implementing ability to force certain minimum lint levels anymore.</p>



<a name="240635156"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Force%20warnings%20on%20lints%20%20compiler-team%23434/near/240635156" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Force.20warnings.20on.20lints.20.20compiler-team.23434.html#240635156">(May 28 2021 at 17:22)</a>:</h4>
<p>I also find there's a lot overlap in purpose between this and <code>-F</code> and IME our lint permissions story is becoming a huge mess at this point tbh.</p>



<a name="240636801"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Force%20warnings%20on%20lints%20%20compiler-team%23434/near/240636801" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Force.20warnings.20on.20lints.20.20compiler-team.23434.html#240636801">(May 28 2021 at 17:35)</a>:</h4>
<p><span class="user-mention" data-user-id="123586">@nagisa</span> This <em>is</em> intended to be analogous to forbid.</p>



<a name="240641256"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Force%20warnings%20on%20lints%20%20compiler-team%23434/near/240641256" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Force.20warnings.20on.20lints.20.20compiler-team.23434.html#240641256">(May 28 2021 at 18:12)</a>:</h4>
<p>Right, so it would make sense to me if we looked for ways to refactor <code>-F</code>/<code>--forbid</code> to enable specification different minimum lint levels, thus generalizing the flag/mechanism.</p>
<p>At the very least the one benefit that this would give us that we would avoid having multiple similar in purpose flags each with their own slightly different behaviours and code paths.</p>



<a name="240641677"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Force%20warnings%20on%20lints%20%20compiler-team%23434/near/240641677" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Force.20warnings.20on.20lints.20.20compiler-team.23434.html#240641677">(May 28 2021 at 18:15)</a>:</h4>
<p>I still have no idea what the behaviour of this functionality should be when in combination with <code>--cap-lints</code>. Given its purpose it seems like <code>--force-warn</code> should override <code>--cap-lints</code> -- this is another point that concerns me. What when we want to add something that overrides <code>--force-warn</code>? Yet another flag?</p>



<a name="240644966"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Force%20warnings%20on%20lints%20%20compiler-team%23434/near/240644966" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Force.20warnings.20on.20lints.20.20compiler-team.23434.html#240644966">(May 28 2021 at 18:41)</a>:</h4>
<p>I don't think this is a slippery slope. force-warn exists for two main purposes:<br>
1) future-compatibility warnings, where even with cap-lints we want to be able to surface/capture them so that people know their dependencies may have an issue. For this, it'd either be enabled for very specific lints or enabled by tools like cargo that may capture and summarize the output in some way, and either way it doesn't need an override.<br>
2) People who want to apply a lint to all their dependencies to detect specific things. This would mean people are setting it explicitly, so it doesn't need an override.</p>



<a name="240661777"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Force%20warnings%20on%20lints%20%20compiler-team%23434/near/240661777" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Force.20warnings.20on.20lints.20.20compiler-team.23434.html#240661777">(May 28 2021 at 21:18)</a>:</h4>
<p><span class="user-mention" data-user-id="239881">@Josh Triplett</span>  I don't really agree with that characterization of the reason <code>--force-warn</code> exists. It is being added for one purpose, and that is <code>cargo fix --edition</code>. </p>
<p>Future-incompatible warnings already have a "force" mechanism to override cap-lints (via <a href="https://github.com/rust-lang/rust/blob/0e44ca6dba86faf76daa7b06d9486f23812d4ccf/compiler/rustc_lint_defs/src/lib.rs#L144-L147">future_breakage</a>). The intent is to slowly roll that out for additional future-incompat warnings, and I don't expect anyone to need to have manual control over that.</p>
<p><code>--force-warn</code> could certainly be used for blanket controls for all dependencies, but that is not really a use case that I think should be encouraged. Forbid already exists to enforce things.</p>
<p><span class="user-mention" data-user-id="123586">@nagisa</span> , I agree that this is making things complicated and I was initially a little uncomfortable with it. From a CLI perspective, I'm not sure I see how things could be any different (other than changing the names). There needs to be some way to specify the minimum level and lint name. Having two flags to do that (one for errors, the other for warnings) seems reasonable. </p>
<p>I'm uncertain about the implementation side of things. The current PR doesn't look too complicated, though I agree it is a little strange to have yet another code path. I suspect trying to generalize "set min level" would wind up being pretty complicated, too.</p>
<p>As for <code>--cap-lints</code> interaction, that should probably be resolved, but isn't part of the intended use case (cargo doesn't combine them). I agree <code>force-warn</code> should probably take precedence over <code>cap-lints</code>, it might be good to ensure the PR includes a test for that.</p>



<a name="240663092"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Force%20warnings%20on%20lints%20%20compiler-team%23434/near/240663092" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Force.20warnings.20on.20lints.20.20compiler-team.23434.html#240663092">(May 28 2021 at 21:35)</a>:</h4>
<p><span class="user-mention" data-user-id="120518">@Eric Huss</span> That's entirely fair, and I'd agree with your description as being more accurate than mine. Thanks for the correction.</p>



<a name="240663116"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Force%20warnings%20on%20lints%20%20compiler-team%23434/near/240663116" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Force.20warnings.20on.20lints.20.20compiler-team.23434.html#240663116">(May 28 2021 at 21:35)</a>:</h4>
<p>In particular, yes, applying rustfixes is much more relevant.</p>



<a name="240663184"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Force%20warnings%20on%20lints%20%20compiler-team%23434/near/240663184" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Force.20warnings.20on.20lints.20.20compiler-team.23434.html#240663184">(May 28 2021 at 21:36)</a>:</h4>
<p>I think it's still the case that, because of the intended use cases, it isn't likely that someone would need to override <code>--force-warn</code> rather than just not passing it in the first place.</p>



<a name="240663608"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Force%20warnings%20on%20lints%20%20compiler-team%23434/near/240663608" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Force.20warnings.20on.20lints.20.20compiler-team.23434.html#240663608">(May 28 2021 at 21:40)</a>:</h4>
<p>Is there a mechanism that cargo can use to enable a particular set of flags that wouldn't otherwise be available for the end-users?</p>



<a name="240663716"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Force%20warnings%20on%20lints%20%20compiler-team%23434/near/240663716" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Force.20warnings.20on.20lints.20.20compiler-team.23434.html#240663716">(May 28 2021 at 21:41)</a>:</h4>
<p>I think as long as we're confident this is cargo-only we can also do a bare minimum implementation/design work as well as strive to minimize the affect on the rustc implementation that this feature could otherwise have.</p>



<a name="240665243"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Force%20warnings%20on%20lints%20%20compiler-team%23434/near/240665243" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Force.20warnings.20on.20lints.20.20compiler-team.23434.html#240665243">(May 28 2021 at 21:58)</a>:</h4>
<p>There isn't really a way to have "cargo only" flags.  We could just leave it hidden and undocumented, but I'm not sure that would be effective long-term.    Another option would be to reject that flag in RUSTFLAGS, but I'm not too comfortable with that, either.</p>



<a name="241374337"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/233931-t-compiler/major%20changes/topic/Force%20warnings%20on%20lints%20%20compiler-team%23434/near/241374337" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> triagebot <a href="https://rust-lang.github.io/zulip_archive/stream/233931-t-compiler/major-changes/topic/Force.20warnings.20on.20lints.20.20compiler-team.23434.html#241374337">(Jun 03 2021 at 10:50)</a>:</h4>
<p>This proposal has been accepted: <a href="https://github.com/rust-lang/compiler-team/issues/434">#434</a>.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>